package cn.iocoder.yudao.module.mqtt.dal.mysql.deviceauth;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.dal.dataobject.deviceauth.DeviceAuthDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mqtt.controller.admin.deviceauth.vo.*;

/**
 * 设备报警授权 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface DeviceAuthMapper extends BaseMapperX<DeviceAuthDO> {

    default PageResult<DeviceAuthDO> selectPage(DeviceAuthPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceAuthDO>()
                .eqIfPresent(DeviceAuthDO::getDeviceId, reqVO.getDeviceId())
                .eqIfPresent(DeviceAuthDO::getAlarmId, reqVO.getAlarmId())
                .eqIfPresent(DeviceAuthDO::getUserId, reqVO.getUserId())
                .likeIfPresent(DeviceAuthDO::getUserName, reqVO.getUserName())
                .eqIfPresent(DeviceAuthDO::getOpenWeixin, reqVO.getOpenWeixin())
                .eqIfPresent(DeviceAuthDO::getOpenSms, reqVO.getOpenSms())
                .eqIfPresent(DeviceAuthDO::getArarmStatus, reqVO.getArarmStatus())
                .eqIfPresent(DeviceAuthDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(DeviceAuthDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceAuthDO::getId));
    }

}